package com.tark.service.qrcode.util.constant;

public enum ResultStatusEnum {

	OK("ok", "成功"), 
	ERROR("error", "错误"), 
	NEED_TOKEN("needToken", "未登录"), 
	ACCESS_DENY("accessDeny","ACCESS_DENY");

	private String code;
	private String name;

	// 构造方法
	private ResultStatusEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static String fromCode(String code) {
		for (ResultStatusEnum c : ResultStatusEnum.values()) {
			if (c.getCode().equalsIgnoreCase(code)) {
				return c.name();
			}
		}
		return null;
	}
}
